<?php

    class itSimpleTemplateTest extends itTestCase {
        
        /**
         * @test
         */
        public function testGeneral() {
            $simple = new itSimpleTemplate();
            $simple->setPrefix('A');
            $this->assertEquals('A', $simple->getPrefix());
            $simple->setTemplate('Template');
            $this->assertEquals('Template', $simple->getTemplate());
            
            $simple = new itSimpleTemplate('A', array('x1' => array(1, 2, 3), 'x2' => array(1, 2)));
            $this->assertEquals('A', $simple->getTemplate());
            $this->assertEquals(array('x1' => array(1, 2, 3), 'x2' => array(1, 2)), $simple->getVariables());
        }
        
        public function testTemplates() {
            $simple = new itSimpleTemplate('/home/drapeko/%namespace%/%class%.%ext%', array('ext' => array('php', 'class.php')));
            $expected = array(
                '/home/drapeko/Namespace/Class.php',
                '/home/drapeko/Namespace/Class.class.php'
            );
            $this->assertEquals($expected, (array)$simple->getPath('Namespace\Class'));
            
            $simple = new itSimpleTemplate('/home/drapeko/%lowernamespace%/%lowerclass%.%ext%', array('ext' => array('php', 'class.php')));
            $expected = array(
                '/home/drapeko/namespace/class.php',
                '/home/drapeko/namespace/class.class.php'
            );
            $this->assertEquals($expected, (array)$simple->getPath('Namespace\Class'));
            
            $simple = new itSimpleTemplate('%x%/%y%', array('x' => array(1, 2), 'y' => array(1, 2)));
            $this->assertEquals(4, count((array)$simple->getPath('Namespace\Class')));
        }
        
    }
    
?>